Skip to content

fix(ui): reconcile modifier state for Firefox resistFingerprinting (#1305)#1344

Draft
adamshiervani wants to merge 2 commits into
devfrom
fix/1305
Draft

fix(ui): reconcile modifier state for Firefox resistFingerprinting (#1305)#1344
adamshiervani wants to merge 2 commits into
devfrom
fix/1305

Conversation

@adamshiervani
Copy link
Copy Markdown
Contributor

Summary

  • Firefox's resistFingerprinting suppresses standalone modifier key events (Shift, Ctrl, Alt, Meta keydown/keyup never fire), causing uppercase letters and modified keys to be sent as unmodified
  • Adds modifier reconciliation that checks e.shiftKey/e.ctrlKey/e.altKey/e.metaKey boolean properties after each keydown/keyup and synthesizes missing modifier press/release events
  • Fixes isWindows() detection to avoid RFP spoofing navigator.platform to "Win32", which incorrectly activated AltGr buffering on non-Windows systems

Closes #1305

AI Agent and others added 2 commits March 26, 2026 18:57
…sistFingerprinting spoofing (#1305)

Firefox's resistFingerprinting (RFP) spoofs navigator.platform to "Win32" on
all OSes, causing isWindows() to return true on Linux. This activates the
Windows-specific AltGr key buffering logic, which combined with RFP's ~100ms
timestamp precision reduction makes the 3ms AltGr timing check unreliable,
potentially swallowing or misrouting key events during password entry.

Fix:
1. Use navigator.userAgentData?.platform (User-Agent Client Hints API) when
   available (Chromium browsers). This API is not affected by RFP.
2. For Firefox/Safari (no userAgentData), detect RFP by checking if both
   Date.now() and performance.timeOrigin are clamped to 100ms boundaries.
   When RFP is detected, don't trust the spoofed platform value and return
   false, disabling the unreliable AltGr workaround.
terryrankine added a commit to terryrankine/kvm that referenced this pull request May 7, 2026
…ingerprinting

Applies jetkvm#1344 adapted for the Luckfox fork architecture. Firefox with
resistFingerprinting suppresses standalone modifier keydown/keyup events: pressing
Shift+A fires only KeyA with shiftKey=true, never a preceding ShiftLeft keydown.

Adds `reconcileModifiers()` in useKeyboardEvents.ts, called from keyDownHandler
after the existing modifier filter. It walks e.shiftKey/ctrlKey/altKey/metaKey
and injects the corresponding Left-side HID modifier code into the active set if
the flag is true but the modifier is not yet tracked — skipping the case where the
current event itself is that modifier key (handled by the normal path). The keyup
path is already correct: handleModifierKeys strips modifiers whose flag is false.

The upstream also patched isWindows() to detect RFP-spoofed navigator.platform,
but that function is unused in this fork (no AltGr buffering logic), so it was
not ported.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Firefox resist fingerprinting breaks target device login

1 participant